<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script type="text/javascript">
    function show() {
        var r = confirm("delete");
        if (r) {
            alert("1");
        } else {
            alert("2");
        }
    }
</script>
<body>
<button onclick="show()"></button>
</body>
</html>